<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr" lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Updates on filter simulation (Page 1) / UADE - Developer discussion / Kohina</title>
<link rel="stylesheet" type="text/css" href="UADE%20-%20Developer%20discussion%20%233_pliki/Kohina.css">
<!--[if lte IE 6]><script type="text/javascript" src="style/imports/minmax.js"></script><![endif]-->
<link rel="alternate" type="application/atom+xml" href="http://board.kohina.net/extern.php?action=feed&amp;tid=850&amp;type=atom" title="Atom topic feed">
<script src="UADE%20-%20Developer%20discussion%20%233_pliki/ga.js" async="" type="text/javascript"></script><script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-21027425-1']);
_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>

<body>

<div id="punviewtopic" class="pun">
<div class="top-box"><div><!-- Top Corners --></div></div>
<div class="punwrap">

<div id="brdheader" class="block">
	<div class="box">
		<div id="brdtitle" class="inbox">
			<h1><a href="http://board.kohina.net/index.php">Kohina</a></h1>
			<div id="brddesc">Old school game and demo music</div>
		</div>
		<div id="brdmenu" class="inbox">
			<ul>
				<li id="navindex" class="isactive"><a href="http://board.kohina.net/index.php">Index</a></li>
				<li id="navuserlist"><a href="http://board.kohina.net/userlist.php">User list</a></li>
				<li id="navrules"><a href="http://board.kohina.net/misc.php?action=rules">Rules</a></li>
				<li id="navsearch"><a href="http://board.kohina.net/search.php">Search</a></li>
				<li id="navregister"><a href="http://board.kohina.net/register.php">Register</a></li>
				<li id="navlogin"><a href="http://board.kohina.net/login.php">Login</a></li>
			</ul>
		</div>
		<div id="brdwelcome" class="inbox">
			
			<p>You are not logged in.</p>
			<ul class="conr">
				<li><span><a href="http://board.kohina.net/search.php?action=show_recent" title="Find topics which contain recent posts.">Active topics</a></span></li>
				<li><span><a href="http://board.kohina.net/search.php?action=show_unanswered" title="Find topics which have not been replied to.">Unanswered topics</a></span></li>
			</ul>
			<div class="clearer"></div>
		</div>
	</div>
</div>

<div id="announce" class="block">
	<div class="hd"><h2><span>Announcement</span></h2></div>
	<div class="box">
		<div id="announce-block" class="inbox">
			<div class="usercontent">We just changed the forum software, please contact the <a href="mailto:board@kohina.net">staff</a> if something is fobar!</div>
		</div>
	</div>
</div>

<div id="brdmain">
<div class="linkst">
	<div class="inbox crumbsplus">
		<ul class="crumbs">
			<li><a href="http://board.kohina.net/index.php">Index</a></li>
			<li><span>»&nbsp;</span><a href="http://board.kohina.net/viewforum.php?id=7">UADE - Developer discussion</a></li>
			<li><span>»&nbsp;</span><a href="http://board.kohina.net/viewtopic.php?id=850"><strong>Updates on filter simulation</strong></a></li>
		</ul>
		<div class="pagepost">
			<p class="pagelink conl"><span class="pages-label">Pages: </span><strong class="item1">1</strong></p>
			<p class="postlink conr"><a href="http://board.kohina.net/post.php?tid=850">Post reply</a></p>
		</div>
		<div class="clearer"></div>
	</div>
</div>

<div id="p4765" class="blockpost rowodd blockpost1">
	<h2><span><span class="conr">#1</span> <a href="http://board.kohina.net/viewtopic.php?pid=4765#p4765">2006-05-05 08:08:58</a></span></h2>
	<div class="box">
		<div class="inbox">
			<div class="postbody">
				<div class="postleft">
					<dl>
						<dt><strong>alankila</strong></dt>
						<dd class="usertitle"><strong>Guest</strong></dd>
					</dl>
				</div>
				<div class="postright">
					<h3>Re: Updates on filter simulation</h3>
					<div class="postmsg">
						<p>Well well, I finally managed to draw proper pictures of the 
Amiga's LED filter frequency responses. I had a nasty bug last time I 
tried this and due to that concluded (in puzzlement) that substracting 
spectra doesn't work for some reason. Well, it does, and here are the 
results.</p><p>Here are the measurements for Amiga 500 and Amiga 1200 
filter responses. Amiga 500 has some kind of noise near 20 kHz which I'm
 not prepared to explain or model in any fashion:</p><p><a href="http://bel.fi/%7Ealankila/led-filter-frequency-response.png">http://bel.fi/~alankila/led-filter-freq … sponse.png</a></p><p>Here is the LED simulation as given by UADE's current CVS code:</p><p><a href="http://bel.fi/%7Ealankila/uade-led-difference.png">http://bel.fi/~alankila/uade-led-difference.png</a></p><p>(This is not a perfect fit. With the cost of some more multiplications, I can make a better match:</p><p><a href="http://bel.fi/%7Ealankila/led-improved-patch.png">http://bel.fi/~alankila/led-improved-patch.png</a><br>)</p><p>The
 true LED filter would appear to be an analog 2nd order Butterworth 
filter. This filter could be simulated digitally but we can't do it at 
44.1 kHz sampling rate due to the frequency warping effect of the 
bilinear transformation. (What this means in non-DSP jargon is that when
 we take an analog filter design and convert it into digital domain, we 
come to represent the entire frequency range of analog filter (0 to 
infinity) in the smaller digital range (0 .. nyquist). The frequency 
warping is of course nonlinear, but distortion increases rapidly as we 
approach the nyquist.)</p><p>What it means may be even better described by pictures:</p><p><a href="http://bel.fi/%7Ealankila/butterworth-at-44100.png">http://bel.fi/~alankila/butterworth-at-44100.png</a><br><a href="http://bel.fi/%7Ealankila/butterworth-at-96000.png">http://bel.fi/~alankila/butterworth-at-96000.png</a></p><p>We
 could use a more accurate butterworth design if we initially 
synthesised on another sampling frequency such as 96 kHz or 88.2 kHz and
 then made all the filtering we need and then threw away every second 
sample.</p><p>-- <br>Antti</p>
					</div>
				</div>
			</div>
		</div>
		<div class="inbox">
			<div class="postfoot clearb">
				<div class="postfootleft"></div>
				<div class="postfootright">
					<ul>
						<li class="postquote"><span><a href="http://board.kohina.net/post.php?tid=850&amp;qid=4765">Quote</a></span></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>

<div id="p4766" class="blockpost roweven">
	<h2><span><span class="conr">#2</span> <a href="http://board.kohina.net/viewtopic.php?pid=4766#p4766">2006-05-05 08:27:57</a></span></h2>
	<div class="box">
		<div class="inbox">
			<div class="postbody">
				<div class="postleft">
					<dl>
						<dt><strong>alankila</strong></dt>
						<dd class="usertitle"><strong>Guest</strong></dd>
					</dl>
				</div>
				<div class="postright">
					<h3>Re: Updates on filter simulation</h3>
					<div class="postmsg">
						<p>Oh yeah, I also drew a picture of the difference of A1200 and 
A500 outputs through the same method. The picture is a lot noisier 
unfortunately, probably all of that is fault of the worse hardware in 
A500.</p><p><a href="http://bel.fi/%7Ealankila/a500-to-a1200.png">http://bel.fi/~alankila/a500-to-a1200.png</a></p><p>This
 picture reveals the difference in spectra between A500 and A1200 
playing the same song. The model for that seems to work quite well. This
 is clearly a first order filter.</p><p>We might go further in our A500 
simulation and attempt to model some of these distortion effects, but 
before there's any point to attempt that, we should make some kind of 
theory for them. (Theory is an explanation for observed effects, so we 
should think about whether the D/A sucks, or if the capacitors on the 
output path are bad, etc.) I'm myself hesitant to do this -- the sound 
may be more authentic but it would probably not be so pleasing if we 
added them.</p><p>UADE as it currently stands is likely "better" Amiga 500 sound machine than the Amiga 500 itself was.</p>
					</div>
				</div>
			</div>
		</div>
		<div class="inbox">
			<div class="postfoot clearb">
				<div class="postfootleft"></div>
				<div class="postfootright">
					<ul>
						<li class="postquote"><span><a href="http://board.kohina.net/post.php?tid=850&amp;qid=4766">Quote</a></span></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>

<div id="p4767" class="blockpost rowodd">
	<h2><span><span class="conr">#3</span> <a href="http://board.kohina.net/viewtopic.php?pid=4767#p4767">2006-05-05 10:38:05</a></span></h2>
	<div class="box">
		<div class="inbox">
			<div class="postbody">
				<div class="postleft">
					<dl>
						<dt><strong><a href="http://board.kohina.net/profile.php?id=220">mld</a></strong></dt>
						<dd class="usertitle"><strong>member</strong></dd>
						<dd><span>Registered: 2003-02-19</span></dd>
						<dd><span>Posts: 13</span></dd>
						<dd class="usercontacts"><span class="website"><a href="http://zakalwe.fi/uade">Website</a></span></dd>
					</dl>
				</div>
				<div class="postright">
					<h3>Re: Updates on filter simulation</h3>
					<div class="postmsg">
						<p>nice work anti!</p><p>how costly would those "extra multiplications" be to improve the a1200 filter model? Hope it doesn't require a 64bit machine ;-)</p><p>Ok,seriously
 ... about artficially "deteriorate" the output for the filters? 
Question is really if it's cheap component causing the signal dirt, and 
if all a500 behaved the same.<br>In theory I see a point getting even 
closer to the real thing, but practically I think it's not useful... (In
 RL, I'm more a gfx dude, so anything causing artifacts in a pic is 
something to be filtered out, instead of being filtered in. *g*)</p>
					</div>
					<div class="postsignature postmsg"><hr><p>mld/uade team</p></div>
				</div>
			</div>
		</div>
		<div class="inbox">
			<div class="postfoot clearb">
				<div class="postfootleft"><p><span>Offline</span></p></div>
				<div class="postfootright">
					<ul>
						<li class="postquote"><span><a href="http://board.kohina.net/post.php?tid=850&amp;qid=4767">Quote</a></span></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>

<div id="p4768" class="blockpost roweven">
	<h2><span><span class="conr">#4</span> <a href="http://board.kohina.net/viewtopic.php?pid=4768#p4768">2006-05-05 11:28:43</a></span></h2>
	<div class="box">
		<div class="inbox">
			<div class="postbody">
				<div class="postleft">
					<dl>
						<dt><strong>alankila</strong></dt>
						<dd class="usertitle"><strong>Guest</strong></dd>
					</dl>
				</div>
				<div class="postright">
					<h3>Re: Updates on filter simulation</h3>
					<div class="postmsg">
						<p>Well, we have several strategies on which to continue improving the UADE filter model.</p><p>We
 can continue tweaking the current code, in which case I'd simply add 
one more filtering step into the A500 and A1200 LED paths and that'd be 
it. They aren't costly at all -- I mostly mention "a few extra 
multiplications" to humour shd. We have a long-standing gentlemanny 
disagreement about this matter. However, this model is not precise.</p><p>What
 I really would like to do is to start from the sinc code and use it to 
synthesize Amiga output at a high frequency. After giving it some 
thought, I'd like to synthesize at 3x the output frequency. For 
instance, if target output frequency is 44.1 kHz, then I'd be 
synthesizing at 132.3 kHz frequency. This is chosen to be high enough to
 remove the effects of the bilnear transform from distorting the 
frequency range below 20 kHz, thus allowing me to run the "correct" 
filters without any output frequency dependant hand-fitting apart from 
choosing the correct cutoff frequency, which is trivial.</p><p>Because 
the synthesis to 132 kHz would be done using the sinc-based resampling, 
the output generated would not contain any frequency components above 20
 kHz and it would be safe then to discard 2/3 of the samples and produce
 a working output at 44.1 kHz which could be fed to the speakers.</p><p>I
 do not think it is necessarily a good idea to model the imperfect 
components in Amiga in our models. For instance, the LED filter should 
obviously introduce some kind of noise around -30 dB of the signal 
level. Perhaps we should do that, for authenticity reasons. But I offer 
an analogy: even people who sample SID music from actual C64 go to pains
 to remove electrical noise from the SID chip input. They consider the 
video chip noise on top of the music to be "accidental" rather than 
"intrisic". That would be along my decision as well.</p>
					</div>
				</div>
			</div>
		</div>
		<div class="inbox">
			<div class="postfoot clearb">
				<div class="postfootleft"></div>
				<div class="postfootright">
					<ul>
						<li class="postquote"><span><a href="http://board.kohina.net/post.php?tid=850&amp;qid=4768">Quote</a></span></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>

<div id="p4769" class="blockpost rowodd">
	<h2><span><span class="conr">#5</span> <a href="http://board.kohina.net/viewtopic.php?pid=4769#p4769">2006-05-05 13:20:25</a></span></h2>
	<div class="box">
		<div class="inbox">
			<div class="postbody">
				<div class="postleft">
					<dl>
						<dt><strong><a href="http://board.kohina.net/profile.php?id=259">shd</a></strong></dt>
						<dd class="usertitle"><strong>Member</strong></dd>
						<dd class="postavatar"><img src="UADE%20-%20Developer%20discussion%20%233_pliki/259.gif" alt="" height="64" width="64"></dd>
						<dd><span>From: Tampere, Finland</span></dd>
						<dd><span>Registered: 2003-06-29</span></dd>
						<dd><span>Posts: 564</span></dd>
						<dd class="usercontacts"><span class="website"><a href="http://www.iki.fi/shd">Website</a></span></dd>
					</dl>
				</div>
				<div class="postright">
					<h3>Re: Updates on filter simulation</h3>
					<div class="postmsg">
						<div class="quotebox"><blockquote><div><p>In theory I see a point 
getting even closer to the real thing, but practically I think it's not 
useful... (In RL, I'm more a gfx dude, so anything causing artifacts in a
 pic is something to be filtered out, instead of being filtered in. *g*)</p></div></blockquote></div><p>I
 agree. My take is that the code must be as simple as possible with the 
constraint that there is no audible difference to the real thing. A 
change in frequency response will probably not improve anything. If 
there is any problem (do we have any problems?), it's somewhere else. 
Maybe some analog artifact.</p>
					</div>
					<div class="postsignature postmsg"><hr><p>Use UADE for Amiga music playback: <a href="http://zakalwe.fi/uade/">http://zakalwe.fi/uade/</a></p></div>
				</div>
			</div>
		</div>
		<div class="inbox">
			<div class="postfoot clearb">
				<div class="postfootleft"><p><span>Offline</span></p></div>
				<div class="postfootright">
					<ul>
						<li class="postquote"><span><a href="http://board.kohina.net/post.php?tid=850&amp;qid=4769">Quote</a></span></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>

<div id="p4770" class="blockpost roweven">
	<h2><span><span class="conr">#6</span> <a href="http://board.kohina.net/viewtopic.php?pid=4770#p4770">2006-05-05 19:53:52</a></span></h2>
	<div class="box">
		<div class="inbox">
			<div class="postbody">
				<div class="postleft">
					<dl>
						<dt><strong>alankila</strong></dt>
						<dd class="usertitle"><strong>Guest</strong></dd>
					</dl>
				</div>
				<div class="postright">
					<h3>Re: Updates on filter simulation</h3>
					<div class="postmsg">
						<p>There is now an experimental patch that reproduces the filter 
behaviour as perfectly as I can make it. It should be very accurate now.
 Here's a typical picture showing the average power spectra of UADE vs. 
Amiga playing the same song:</p><p><a href="http://bel.fi/%7Ealankila/A500-filter.png">http://bel.fi/~alankila/A500-filter.png</a></p><p>(The
 picture is with LED filter disabled.) The sudden crash in output power 
after 19.5 kHz is intentional and byproduct of the sinc filter that cuts
 very steeply into the signal and quiets it for 22 kHz nyquist to avoid 
aliasing.</p><p>The code is very slow because it does a lot of redundant
 computation per sample. Additionally, it is only worth damn if you run 
it with the sinc interpolator. It is likely to be detrimental if you use
 the antialiasing interpolator!</p><p><a href="http://bel.fi/%7Ealankila/uade-perfect-filter.diff">http://bel.fi/~alankila/uade-perfect-filter.diff</a></p><p>The patch introduces the following DSP improvements:</p><p>- 3x upsampling for digital filters<br>- new butterworth LED filter design (should be exact)<br>- new A500 static filter (should be exact)<br>- sinc table interpolation for jitter noise removal (reduces noise around 20 kHz)<br>- 48 kHz mixing frequency (just for test)</p><p>The
 patch removes the old A500S filters as small byproduct. This is not 
intentional, I merely killed them off from confusing me when I wrote the
 code.</p><p>shd should provide me a version of UADE with choosable 
output frequency so that I could break this patch into small parts and 
feed the entire work in small pieces.</p><p>We have some known defects. 
Firstly, Amiga 500 LED filter uses poor components which probably 
explains why the Amiga 500 LED filter misbehaves slightly. (The model is
 only accurate to about 0.5 dB for A500.) Additionally, Amiga 1200 seems
 to leak a bit of current into the LED filter even when the LED filter 
is off. This causes a very small treble attenuation (around 0.5 dB). The
 treble attenuation disappears when the LED filter is behaved, realizing
 ideal Butterworth. Both effects are not modelled.</p><p>-- <br>Antti</p>
					</div>
				</div>
			</div>
		</div>
		<div class="inbox">
			<div class="postfoot clearb">
				<div class="postfootleft"></div>
				<div class="postfootright">
					<ul>
						<li class="postquote"><span><a href="http://board.kohina.net/post.php?tid=850&amp;qid=4770">Quote</a></span></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>

<div id="p4772" class="blockpost rowodd">
	<h2><span><span class="conr">#7</span> <a href="http://board.kohina.net/viewtopic.php?pid=4772#p4772">2006-05-07 10:10:46</a></span></h2>
	<div class="box">
		<div class="inbox">
			<div class="postbody">
				<div class="postleft">
					<dl>
						<dt><strong>alankila</strong></dt>
						<dd class="usertitle"><strong>Guest</strong></dd>
					</dl>
				</div>
				<div class="postright">
					<h3>Re: Updates on filter simulation</h3>
					<div class="postmsg">
						<p>Due to changes in the CVS version, a new .diff file was produced and put into the URL above.</p><p>The remaining DSP improvements are:</p><p>- filter upsampling (2x or 3x depending on chosen output frequency value) when sinc interpolator is in use<br>-
 denormal number avoidance (denormals are very small floating point 
numbers that put FPUs into slow mode and can harm performance)<br>- sinc table interpolation for slightly improved accuracy at stopband (20 kHz)</p>
					</div>
				</div>
			</div>
		</div>
		<div class="inbox">
			<div class="postfoot clearb">
				<div class="postfootleft"></div>
				<div class="postfootright">
					<ul>
						<li class="postquote"><span><a href="http://board.kohina.net/post.php?tid=850&amp;qid=4772">Quote</a></span></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="postlinksb">
	<div class="inbox crumbsplus">
		<div class="pagepost">
			<p class="pagelink conl"><span class="pages-label">Pages: </span><strong class="item1">1</strong></p>
			<p class="postlink conr"><a href="http://board.kohina.net/post.php?tid=850">Post reply</a></p>
		</div>
		<ul class="crumbs">
			<li><a href="http://board.kohina.net/index.php">Index</a></li>
			<li><span>»&nbsp;</span><a href="http://board.kohina.net/viewforum.php?id=7">UADE - Developer discussion</a></li>
			<li><span>»&nbsp;</span><a href="http://board.kohina.net/viewtopic.php?id=850"><strong>Updates on filter simulation</strong></a></li>
		</ul>
		<div class="clearer"></div>
	</div>
</div>
</div>

<div id="brdfooter" class="block">
	<h2><span>Board footer</span></h2>
	<div class="box">
		<div id="brdfooternav" class="inbox">
			<div class="conl">
				<form id="qjump" method="get" action="viewforum.php">
					<div><label><span>Jump to<br></span>
					<select name="id" onchange="window.location=('viewforum.php?id='+this.options[this.selectedIndex].value)">
						<optgroup label="Kohina">
							<option value="4">Game and Demo Music</option>
							<option value="3">Hardware Discussion</option>
							<option value="5">Suggestions &amp; Feedback</option>
							<option value="2">The Kohina Playground</option>
							<option value="8">Song Requests and Recordings</option>
						</optgroup>
						<optgroup label="UADE - Unix Amiga Delitracker Emulator">
							<option value="6">UADE - User discussion</option>
							<option value="7" selected="selected">UADE - Developer discussion</option>
						</optgroup>
						<optgroup label="XMMS-SID - SID-plugin for XMMS">
							<option value="9">XMMS-SID Discussion</option>
						</optgroup>
					</select>
					<input value=" Go " accesskey="g" type="submit">
					</label></div>
				</form>
			</div>
			<div class="conr">
				<p id="feedlinks"><span class="atom"><a href="http://board.kohina.net/extern.php?action=feed&amp;tid=850&amp;type=atom">Atom topic feed</a></span></p>
				<p id="poweredby">Powered by <a href="http://fluxbb.org/">FluxBB</a></p>
			</div>
			<div class="clearer"></div>
		</div>
	</div>
</div>

</div>
<div class="end-box"><div><!-- Bottom corners --></div></div>
</div>



</body></html>